package com.study.string;

public class StringDemo2 {
    public static void main(String[] args) {
        String s = new String("hello world");
        System.out.println(s.charAt(4));
        char[] charArray = s.toCharArray();
        for(int i = 0; i < charArray.length; i++) {
            System.out.print(charArray[i]);
        }
        System.out.println("\n");
        String substring = s.substring(1, 4);
        System.out.println(substring);
        String replace = s.replace("ell", "iii");
        System.out.println(replace);
        System.out.println(s.contains("wor"));
        System.out.println(s.startsWith("hel"));
        String s2 = "ha,hei,hu,ou";
        String[] split = s2.split(",");
        for (int i = 0; i < split.length; i++) {
            System.out.println(split[i]);
        }
    }
}
